loginApp.controller('registerController', ['$scope', '$location', 'usersService',
    function($scope, $location, usersService) {
        $scope.user = {
            username: '',
            password: ''
        };
        $scope.submit = function(user) {
            var users = new usersService(user);
            users.$create(function() {
                $location.path('/login');
            }, function(e) {
                $location.path('/login');
            });
        };
    }
]);
